<?php $post = $this->get('post');?>
<form method="post" action="<?php _actionUrl($this)?>" onsubmit="return ajax_form(this)" id="task-form" enctype="multipart/form-data">
<input type="hidden" name="ID" value="<?php _e($post['ID'])?>"/>
<div class="x-list-title"> 
<table height="100%" width="100%" border="0" cellpadding="0">
<tr><td>
<h2>Sửa thông tin dự án</h2>
</td>
<td align="right">

</td>
</tr></table>
</div>
<div class="x-form-container">
<table width="100%" border="0" cellpadding="0" class="x-form">
<tr class="row-message">
	<td colspan="2">
		<div class="form-message"><?php $this->e('message');?></div>
	</td>
</tr>
<tr>
	<td class="x-form-label">
		Mã dự án: 
	</td>
	<td class="x-form-input">
		<input type="text" name="code" style="width:100px" class="x-text" value="<?php _e($post['code']);?>"/>
	</td>
</tr>
<tr>
	<td class="x-form-label">
		Tên dự án: 
	</td>
	<td class="x-form-input">
		<input type="text" name="title" style="width:570px" class="x-text" value="<?php _e($post['title']);?>"/>
	</td>
</tr>
<tr>
	<td class="x-form-label">
		Số ngày thực hiện: 
	</td>
	<td class="x-form-input">
		<input type="number" step="0.5" min="0" name="dateof" style="width:100px" class="x-text" value="<?php _e($post['dateof']);?>"/>
	</td>
</tr>
<tr>
	<td class="x-form-label">
		Loại dự án: 
	</td>
	<td class="x-form-input">
	<select class="x-select" name="parent_id">
	<?php foreach( $this->get('cats') as $cat ):?>
	<option value="<?php _e($cat['ID'])?>"<?php _e($cat['ID'] == $post['parent_id'] ? ' selected': '');?>><?php _e($cat['title'])?></option>
	<?php endforeach;?>
	</select>
	</td>
</tr>
<tr>
	<td class="x-form-label">
		Trạng thái: 
	</td>
	<td class="x-form-input">
		<select name="status" class="x-select">
			<option value="active"<?php _e($post['status']=='active' ? ' selected':'')?>><?php _e(get_status('active'))?></option>	
			<option value="inactive"<?php _e($post['status']=='inactive' ? ' selected':'')?>><?php _e(get_status('inactive'))?></option>	
			<option value="complete"<?php _e($post['status']=='complete' ? ' selected':'')?>><?php _e(get_status('complete'))?></option>	
			<option value="cancel"<?php _e($post['status']=='cancel' ? ' selected':'')?>><?php _e(get_status('cancel'))?></option>
		</select>	
	</td>
</tr>
<tr>	
	<td class="x-form-label">
		Ngày bắt đầu: 
	</td>
	<td class="x-form-input">
		<input type="text" title="Kết thúc" name="date_start" onclick="date_picker(this,{format: 'd/m/Y' })" value="<?php _e(show_date(DATE_FORMAT,$post['date_start']));?>" class="x-text x-date"/>
	</td>
</tr>
<tr>	
	<td class="x-form-label">
		Ngày dự kiến kết thúc: 
	</td>
	<td class="x-form-input">
		<input type="text" title="Kết thúc" name="date_end_forecast" onclick="date_picker(this,{format: 'd/m/Y' })" value="<?php _e(show_date(DATE_FORMAT,$post['date_end_forecast']));?>" class="x-text x-date"/>
	</td>
</tr>
<tr>	
	<td class="x-form-label">
		Ngày kết thúc thực tế: 
	</td>
	<td class="x-form-input">
		<input type="text" title="Kết thúc" name="date_end" onclick="date_picker(this,{format: 'd/m/Y' })" value="<?php _e(show_date(DATE_FORMAT,$post['date_end']));?>" class="x-text x-date"/>
	</td>
</tr>
<tr>
	<td class="x-form-label">
		Tiến độ: 
	</td>
	<td class="x-form-input">
		<input type="text" name="rate" onclick="status_picker(this)" class="x-text x-status" value="<?php _e($post['rate']);?>"/> %
	</td>
</tr>
<tr>	
	<td class="x-form-label">
		Người tạo:
	</td>
	<td class="x-form-input">
	<?php $user = $this->get('user');?>
	<a href='#User/Info?ID=<?php _e($user['ID'])?>'><b><?php _e($user['username']); ?></b></a>
	</td>
</tr>
<?php $users = $this->get('users');?>
<tr>	
	<td class="x-form-label">
		Người phụ trách: <sup><span class="hint" title="Được phép giao việc, cập nhật tiến độ">[?]</sup>
	</td>
	<td class="x-form-input">
		<div class="x-select-users" x-name="supervisor[]" x-title="Người phụ trách">
		<?php foreach( $users as $u ):?>
		<?php if( $u['is_supervisor'] == 'yes' ):?>
		<span class="item">
			<input type="hidden" name="supervisor[]" value="<?php _e($u['ID'])?>"><a><?php _e($u['username'])?></a><span class="close">x</span>
		</span>
		<?php endif;?>
		<?php endforeach;?>	
		</div>
	</td>
</tr>
<tr>	
	<td class="x-form-label">
		Cho phép xem: <sup class="hint" title="Có quyền xem thông tin dự án">[?]</sup>
	</td>
	<td class="x-form-input">
		<div class="x-select-users" x-name="guest[]" x-title="Cho phép xem">
		<?php foreach( $users as $u ):?>
		<?php if( $u['is_guest'] == 'yes' ):?>
		<span class="item">
			<input type="hidden" name="guest[]" value="<?php _e($u['ID'])?>"><a><?php _e($u['username'])?></a><span class="close">x</span>
		</span>
		<?php endif;?>
		<?php endforeach;?>		
		</div>
	</td>
</tr>
<tr>
	<td class="x-form-label">
		Mô tả:
	</td>
	<td class="x-form-input">
		<textarea name="desc" class="x-text x-editor" style="width:609px;height:200px"><?php _e($post['desc']);?></textarea>
	</td>
</tr>
<tr>
	<td class="x-form-label" align="center" valign="top">
		<span class="x-attachment"></span>
	</td>
	<td class="x-form-input" valign="top">
		<?php foreach( $this->get('files') as $file ):?>
		<div class='x-file-info'>
			<input checked type='checkbox' name='files[]' value='<?php _e($file['ID']);?>'/>
			<a href="<?php _ctrUrl($this);?>/File?ID=<?php _e($file['ID']);?>" target="_blank"><?php _e($file['filename']);?> <?php _e($file['size']);?> KB	</a>
		</div>
		<?php endforeach;?>
		<div class="x-files" url="<?php _ctrUrl($this);?>/Upload?ID=<?php _e($post['ID'])?>"></div>
	</td>
</tr>
<tr>
	<td></td>
	<td>
		<?php _e(tpl_button_add('Cập nhật'));?>
		<a class="x-button x-fresh" href="#Project/Index/View?ID=<?php _e($post['ID']);?>">Hủy bỏ</a>	
		<a class="x-button x-fresh" onclick="module_delete('<?php _baseUrl()?>/Project/Index/Delete?ID=<?php _e($post['ID'])?>')">Xóa dự án</a>
	</td>
</tr>
</table></div>
</form>